#define _CRT_SECURE_NO_WARNINGS  1

class Solution {
    string a[10] = { "","","abc","def","ghi","jkl","mno","pqrs","tuv","wxyz" };

public:
    void combine(string digits, int level, string cbstr, vector<string>& v)
    {
        if (level == digits.size())
        {
            v.push_back(cbstr);
            return;
        }

        int num = digits[level] - '0';
        string str = a[num];
        for (int i = 0; i < str.size(); i++)
        {
            combine(digits, level + 1, cbstr + str[i], v);
        }
    }

    vector<string> letterCombinations(string digits)
    {
        vector<string> v;
        if (digits.empty())
            return v;
        combine(digits, 0, "", v);
        return v;
    }
};